package club.justwill.single.helper;

import club.justwill.single.model.ServiceChannel;
import club.justwill.single.model.UserType;

/**
 * Created by xiangnan on 15-12-23.
 */
public class CoreHelper {
    /**
     * service channel related helper
     */
    public static final String getServiceChannel(String channel) {
        return channel;
    }


    /**
     * user type related utilities
     */
    public static boolean isMorePowerfulThan(int left, int right) {

        return left > right;
    }

    public static boolean isSystemUser(int type) {
        return UserType.SYSTEM == type || UserType.ANONYMOUS == type;
    }

    public static boolean isCustomer(int type) {
        return UserType.INDIVIDUAL == type || UserType.BUSINESS == type;
    }

    public static boolean isConsumer(int type) {
        return UserType.INDIVIDUAL == type;
    }

    public static boolean isServiceProvider(int type) {
        return UserType.BUSINESS == type;
    }

    public static boolean isAdministrator(int type) {
        return UserType.ADMINISTRATOR == type;
    }

    public static boolean isSuperUser(int type) {
        return isMorePowerfulThan(type, UserType.BUSINESS);
    }

    public static boolean isAnonymousUser(int type) {
        return UserType.ANONYMOUS== type;
    }

}
